
import 'dart:convert';

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

///@description
///打印日志类
class LogUtilTool {
  static const bool _hasLog = true;
  static const JsonEncoder encoder=JsonEncoder.withIndent('   ');
  static const androidLog = MethodChannel("android_log");

  static void println(var obj) {
    if (_hasLog) {
      debugPrint(obj.toString());
    }
  }

  ///格式化下Debug信息
  static void d(String TAG, Object obj) {
    if (_hasLog) {
      if(obj is Map|| obj is List){
        debugPrint('$TAG==>${encoder.convert(obj)}');
      }else{
        debugPrint('$TAG==>${obj.toString()}');
      }
    }
  }
}
